<?php
require __DIR__.'/vendor/autoload.php';

require_once 'bootstrap/app.php';

$config = parse_ini_file('./config.ini', true);
//将日志路径写入全局变量以供实时调用
$_SERVER['LOG_PATH'] = $config['log']['path'];

$redis = new \Predis\Client();

$category = \app\model\BookCategory::all(['ID','LibraryClassficationID']);
foreach ($category as $item) {
    $redis->set($item->LibraryClassficationID, $item->ID);
}

$company = \app\model\Company::all('ID', 'CompanyName', 'ShortName');
foreach ($company as $item) {
    $redis->set($item->CompanyName, $item->ID);
    $redis->set($item->ShortName, $item->ID);
}

$fitReader = \app\model\FitReader::all(['ID', 'FitReader']);
foreach ($fitReader as $item) {
    $redis->set($item->FitReader, $item->ID);
}